'//----------------------------------------------------------------------- '// '// VBStak constant definitions '// '// Date: 02/20/95 '// Version: 1.2 '// '// '//----------------------------------------------------------------------------- '// Stak Status defines Global Const STAK_STATUS_IDLE = 0 Global Const STAK_STATUS_INITIALIZED = 1 Global Const STAK_STATUS_OPENED = 2 Global Const STAK_STATUS_BOUND = 3 Global Const STAK_STATUS_CONNECTED = 4 Global Const STAK_STATUS_SENDING = 5 Global Const STAK_STATUS_LISTENING = 6 Global Const STAK_STATUS_ACCEPTED = 7 '//----------------------------------------------------------------------------- '// Stak Errors Global Const NO_ERROR = 0 Global Const STAK_ERROR_NOPORTS = &H7000 Global Const STAK_ERROR_INVALID_ADDRESS = &H7001 '//----------------------------------------------------------------------------- '// Stak Action Global Const STAK_ACTION_OPEN = 0 Global Const STAK_ACTION_CLOSE = 1 Global Const STAK_ACTION_SEND = 2 Global Const STAK_ACTION_SEND_TO = 2 Global Const STAK_ACTION_GET_SERVICE = 4 Global Const STAK_ACTION_GET_HOST = 5 Global Const STAK_ACTION_GET_PROTOCOL = 6 Global Const STAK_ACTION_LISTEN = 7 '------------------------------------------------------------------ ' ' Global Constants from BSD Sockets ' Global Const FD_SETSIZE = 64 Global Const IOCPARM_MASK = &H7F '/* parameters must be < 128 bytes */ Global Const IOC_VOID = &H20000000 '/* no parameters */ Global Const IOC_OUT = &H40000000 '/* copy out parameters */ Global Const IOC_IN = &H80000000 '/* copy in parameters */ Global Const IOC_INOUT = &HC0000000 '/* ' * Constants and structures defined by the internet system, ' * Per RFC 790, September 1981, taken from the BSD file netinet/in.h. ' */ '/* ' * Protocols ' */ Global Const IPPROTO_IP = 0 '/* dummy for IP */ Global Const IPPROTO_ICMP = 1 '/* control message protocol */ Global Const IPPROTO_GGP = 2 '/* gateway^2 (deprecated) */ Global Const IPPROTO_TCP = 6 '/* tcp */ Global Const IPPROTO_PUP = 12 '/* pup */ Global Const IPPROTO_UDP = 17 '/* user datagram protocol */ Global Const IPPROTO_IDP = 22 '/* xns idp */ Global Const IPPROTO_ND = 77 '/* UNOFFICIAL net disk proto */ Global Const IPPROTO_RAW = 255 '/* raw IP packet */ Global Const IPPROTO_MAX = 256 '/* ' * Port/socket numbers: network standard functions ' */ Global Const IPPORT_ANY = 0 Global Const IPPORT_ECHO = 7 Global Const IPPORT_DISCARD = 9 Global Const IPPORT_SYSTAT = 11 Global Const IPPORT_DAYTIME = 13 Global Const IPPORT_NETSTAT = 15 Global Const IPPORT_FTP = 21 Global Const IPPORT_TELNET = 23 Global Const IPPORT_SMTP = 25 Global Const IPPORT_TIMESERVER = 37 Global Const IPPORT_NAMESERVER = 42 Global Const IPPORT_WHOIS = 43 Global Const IPPORT_MTP = 57 '/* ' * Port/socket numbers: host specific functions ' */ Global Const IPPORT_TFTP = 69 Global Const IPPORT_RJE = 77 Global Const IPPORT_FINGER = 79 Global Const IPPORT_TTYLINK = 87 Global Const IPPORT_SUPDUP = 95 '/* ' * UNIX TCP sockets ' */ Global Const IPPORT_EXECSERVER = 512 Global Const IPPORT_LOGINSERVER = 513 Global Const IPPORT_CMDSERVER = 514 Global Const IPPORT_EFSSERVER = 520 '/* '* UNIX UDP sockets ' */ Global Const IPPORT_BIFFUDP = 512 Global Const IPPORT_WHOSERVER = 513 Global Const IPPORT_ROUTESERVER = 520 ' /* 520+1 also used */ '/* ' * Ports < IPPORT_RESERVED are reserved for ' * privileged processes (e.g. root). ' */ Global Const IPPORT_RESERVED = 1024 '/* ' * Link numbers ' */ Global Const IMPLINK_IP = 155 Global Const IMPLINK_LOWEXPER = 156 Global Const IMPLINK_HIGHEXPER = 158 Global Const INADDR_ANY = &H0 Global Const INADDR_LOOPBACK = &H7F000001 Global Const INADDR_BROADCAST = &HFFFFFFFF Global Const INADDR_NONE = &HFFFFFFFF Global Const WSADESCRIPTION_LEN = 256 Global Const WSASYS_STATUS_LEN = 128 '/* ' * Options for use with [gs]etsockopt at the IP level. ' */ Global Const IP_OPTIONS = 1 '/* set/get IP per-packet options */ '/* ' * Definitions related to sockets: types, address families, options, ' * taken from the BSD file sys/socket.h. ' */ '/* ' * SOCKET type is unsigned. ' */ Global Const INVALID_SOCKET = &HFFFF '?? (SOCKET)(~0) Global Const SOCKET_ERROR = -1 '/* ' * Types ' */ Global Const SOCK_STREAM = 1 '/* stream socket */ Global Const SOCK_DGRAM = 2 '/* datagram socket */ Global Const SOCK_RAW = 3 '/* raw-protocol interface */ Global Const SOCK_RDM = 4 '/* reliably-delivered message */ Global Const SOCK_SEQPACKET = 5 '/* sequenced packet stream */ '/* ' * Option flags per-socket. ' */ Global Const SO_DEBUG = &H1 '/* turn on debugging info recording */ Global Const SO_ACCEPTCONN = &H2 '/* socket has had listen() */ Global Const SO_REUSEADDR = &H4 '/* allow local address reuse */ Global Const SO_KEEPALIVE = &H8 '/* keep connections alive */ Global Const SO_DONTROUTE = &H10 '/* just use interface addresses */ Global Const SO_BROADCAST = &H20 '/* permit sending of broadcast msgs */ Global Const SO_USELOOPBACK = &H40 '/* bypass hardware when possible */ Global Const SO_LINGER = &H80 '/* linger on close if data present */ Global Const SO_OOBINLINE = &H100 '/* leave received OOB data in line */ '#define SO_DONTLINGER (u_int)(~SO_LINGER) '/* ' * Additional options. ' */ Global Const SO_SNDBUF = &H1001 '/* send buffer size */ Global Const SO_RCVBUF = &H1002 '/* receive buffer size */ Global Const SO_SNDLOWAT = &H1003 '/* send low-water mark */ Global Const SO_RCVLOWAT = &H1004 ' /* receive low-water mark */ Global Const SO_SNDTIMEO = &H1005 '/* send timeout */ Global Const SO_RCVTIMEO = &H1006 '/* receive timeout */ Global Const SO_ERROR = &H1007 '/* get error status and clear */ Global Const SO_TYPE = &H1008 ' /* get socket type */ '/* ' * TCP options. ' */ Global Const TCP_NODELAY = &H1 '/* ' * Address families. ' */ Global Const AF_UNSPEC = 0 '/* unspecified */ Global Const AF_UNIX = 1 '/* local to host (pipes, portals) */ Global Const AF_INET = 2 '/* internetwork: UDP, TCP, etc. */ Global Const AF_IMPLINK = 3 '/* arpanet imp addresses */ Global Const AF_PUP = 4 '/* pup protocols: e.g. BSP */ Global Const AF_CHAOS = 5 '/* mit CHAOS protocols */ Global Const AF_NS = 6 '/* XEROX NS protocols */ Global Const AF_ISO = 7 '/* ISO protocols */ Global Const AF_OSI = AF_ISO '/* OSI is ISO */ Global Const AF_ECMA = 8 '/* european computer manufacturers */ Global Const AF_DATAKIT = 9 '/* datakit protocols */ Global Const AF_CCITT = 10 '/* CCITT protocols, X.25 etc */ Global Const AF_SNA = 11 '/* IBM SNA */ Global Const AF_DECnet = 12 '/* DECnet */ Global Const AF_DLI = 13 '/* Direct data link interface */ Global Const AF_LAT = 14 '/* LAT */ Global Const AF_HYLINK = 15 '/* NSC Hyperchannel */ Global Const AF_APPLETALK = 16 '/* AppleTalk */ Global Const AF_NETBIOS = 17 '/* NetBios-style addresses */ Global Const AF_MAX = 18 '/* ' * Level number for (get/set)sockopt() to apply to socket itself. ' */ Global Const SOL_SOCKET = &HFFFF '/* options for socket level */ ''/* ' * Maximum queue length specifiable by listen. ' */ Global Const SOMAXCONN = 5 Global Const MSG_OOB = &H1 '/* process out-of-band data */ Global Const MSG_PEEK = &H2 '/* peek at incoming message */ Global Const MSG_DONTROUTE = &H4 '/* send without using routing tables */ Global Const MSG_MAXIOVLEN = 16 '/* ' * Define constant based on rfc883, used by gethostbyxxxx() calls. ' */ Global Const MAXGETHOSTSTRUCT = 1024 '/* ' * Define flags to be used with the WSAAsyncSelect() call. ' */ Global Const FD_READ = &H1 Global Const FD_WRITE = &H2 Global Const FD_OOB = &H4 Global Const FD_ACCEPT = &H8 Global Const FD_CONNECT = &H10 Global Const FD_CLOSE = &H20 '/* Additional VB_STAK flags Global Const STAK_EVENT_SERVICE = &H40 Global Const STAK_EVENT_HOST = &H80 Global Const STAK_EVENT_PROTOCOL = &H100 Global Const STAK_EVENT_READ = &H1 Global Const STAK_EVENT_WRITE = &H2 Global Const STAK_EVENT_OOB = &H4 Global Const STAK_EVENT_ACCEPT = &H8 Global Const STAK_EVENT_CONNECT = &H10 Global Const STAK_EVENT_CLOSE = &H20 '/* ' * All Windows Sockets error constants are biased by WSABASEERR from '* the "normal" ' */ Global Const WSABASEERR = 10000 Global Const WS_ERROR = &H4000 Global Const WS_ERROR_INVALID_ADDRESS = &H4001 '/* ' * Windows Sockets definitions of regular Microsoft C error constants ' */ 'VB Note: reference to the following error codes requires an offset of ' WSBASEERR ' eg. if WSAGetLastError() = WSBASEERR+WSAEINTR then ... ' ' I use a WSerrorCheck() function to get and verify error codes Global Const WSAEINTR = 4 Global Const WSAEBADF = 9 Global Const WSAEACCES = 13 Global Const WSAEFAULT = 14 Global Const WSAEINVAL = 22 Global Const WSAEMFILE = 24 '/* ' * Windows Sockets definitions of regular Berkeley error constants ' */ Global Const WSAEWOULDBLOCK = 35 Global Const WSAEINPROGRESS = 36 Global Const WSAEALREADY = 37 Global Const WSAENOTSOCK = 38 Global Const WSAEDESTADDRREQ = 39 Global Const WSAEMSGSIZE = 40 Global Const WSAEPROTOTYPE = 41 Global Const WSAENOPROTOOPT = 42 Global Const WSAEPROTONOSUPPORT = 43 Global Const WSAESOCKTNOSUPPORT = 44 Global Const WSAEOPNOTSUPP = 45 Global Const WSAEPFNOSUPPORT = 46 Global Const WSAEAFNOSUPPORT = 47 Global Const WSAEADDRINUSE = 48 Global Const WSAEADDRNOTAVAIL = 49 Global Const WSAENETDOWN = 50 Global Const WSAENETUNREACH = 51 Global Const WSAENETRESET = 52 Global Const WSAECONNABORTED = 53 Global Const WSAECONNRESET = 54 Global Const WSAENOBUFS = 55 Global Const WSAEISCONN = 56 Global Const WSAENOTCONN = 57 Global Const WSAESHUTDOWN = 58 Global Const WSAETOOMANYREFS = 59 Global Const WSAETIMEDOUT = 60 Global Const WSAECONNREFUSED = 61 Global Const WSAELOOP = 62 Global Const WSAENAMETOOLONG = 63 Global Const WSAEHOSTDOWN = 64 Global Const WSAEHOSTUNREACH = 65 Global Const WSAENOTEMPTY = 66 Global Const WSAEPROCLIM = 67 Global Const WSAEUSERS = 68 Global Const WSAEDQUOT = 69 Global Const WSAESTALE = 70 Global Const WSAEREMOTE = 71 '/* ' * Extended Windows Sockets error constant definitions ' */ Global Const WSASYSNOTREADY = 91 Global Const WSAVERNOTSUPPORTED = 92 Global Const WSANOTINITIALISED = 93 '/* ' * Error return codes from gethostbyname( and gethostbyaddr() ' * (when using the resolver). Note that these errors are ' * retrieved via WSAGetLastError() and must therefore follow ' * the rules for avoiding clashes with error numbers from ' * specific implementations or language run-time systems. ' * For this reason the codes are based at 1000+1001. ' * Note also that [WSA]NO_ADDRESS is defined only for ' * compatibility purposes. ' */ '/* Authoritative Answer: Host not found */ Global Const WSAHOST_NOT_FOUND = 1001 Global Const HOST_NOT_FOUND = 1001 '/* Non-Authoritative: Host not found, or SERVERFAIL */ Global Const WSATRY_AGAIN = 1002 Global Const TRY_AGAIN = 1002 '/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ Global Const WSANO_RECOVERY = 1003 Global Const NO_RECOVERY = 1003 '/* Valid name, no data record of requested type */ Global Const WSANO_DATA = 1004 Global Const NO_DATA = 1004 '/* no address, look for MX record */ Global Const WSANO_ADDRESS = 1004 Global Const NO_ADDRESS = 1004 '/* ' * Windows Sockets errors redefined as regular Berkeley error constants ' */ Global Const EWOULDBLOCK = 35 Global Const EINPROGRESS = 36 Global Const EALREADY = 37 Global Const ENOTSOCK = 38 Global Const EDESTADDRREQ = 39 Global Const EMSGSIZE = 40 Global Const EPROTOTYPE = 41 Global Const ENOPROTOOPT = 42 Global Const EPROTONOSUPPORT = 43 Global Const ESOCKTNOSUPPORT = 44 Global Const EOPNOTSUPP = 45 Global Const EPFNOSUPPORT = 46 Global Const EAFNOSUPPORT = 47 Global Const EADDRINUSE = 48 Global Const EADDRNOTAVAIL = 49 Global Const ENETDOWN = 50 Global Const ENETUNREACH = 51 Global Const ENETRESET = 52 Global Const ECONNABORTED = 53 Global Const ECONNRESET = 54 Global Const ENOBUFS = 55 Global Const EISCONN = 56 Global Const ENOTCONN = 57 Global Const ESHUTDOWN = 58 Global Const ETOOMANYREFS = 59 Global Const ETIMEDOUT = 60 Global Const ECONNREFUSED = 61 Global Const ELOOP = 62 Global Const ENAMETOOLONG = 63 Global Const EHOSTDOWN = 64 Global Const EHOSTUNREACH = 65 Global Const ENOTEMPTY = 66 Global Const EPROCLIM = 67 Global Const EUSERS = 68 Global Const EDQUOT = 69 Global Const ESTALE = 70 Global Const EREMOTE = 71 ' Errors Global Const WSANOTINITIALISED_S = "A successful WSAStartup() must occur before using this API." Global Const WSAENETDOWN_S = "The Windows Sockets implementation has detected that the network subsystem has failed." Global Const WSAEADDRINUSE_S = "The specified address is already in use. (See the SO_REUSEADDR socket option under setsockopt().)" Global Const WSAEFAULT_S = "The namelen argument is too small (less than the size of a struct sockaddr)." Global Const WSAEINTR_S = "The (blocking) call was canceled via WSACancelBlockingCall()" Global Const WSAEINPROGRESS_S = "A blocking Windows Sockets call is in progress." Global Const WSAEAFNOSUPPORT_S = "The specified address family is not supported by this protocol." Global Const WSAEINVAL_S = "The socket is already bound to an address." Global Const WSAENOBUFS_S = " Not enough buffers available, too many connections." Global Const WSAENOTSOCK_S = "The descriptor is not a socket." Global Const WSAEADDRNOTAVAIL_S = "The specified address is not available from the local machine." Global Const WSAECONNREFUSED_S = "The attempt to connect was forcefully rejected." Global Const WSAEDESTADDREQ_S = "A destination address is required." Global Const WSAEISCONN_S = "The socket is already connected." Global Const WSAEMFILE_S = "No more file descriptors are available." Global Const WSAENETUNREACH_S = "The network can't be reached from this host at this time." Global Const WSAETIMEDOUT_S = "Attempt to connect timed out without establishing a connection" Global Const WSAEWOULDBLOCK_S = "The socket is marked as non-blocking and the connection cannot be completed immediately. It is possible to select() the socket while it is connecting by select()ing it for writing." Global Const WSAHOST_NOT_FOUND_S = "Authoritative Answer Host not found." Global Const WSATRY_AGAIN_S = "Non-Authoritative Host not found, or SERVERFAIL." Global Const WSANO_RECOVERY_S = "Non recoverable errors, FORMERR, REFUSED, NOTIMP." Global Const WSANO_DATA_S = "Valid name, no data record of requested type." Global Const WSAENOPROTOOPT_S = "The option is unknown or unsupported. In particular." Global Const WSAEACCES_S = "The requested address is a broadcast address, but the appropriate flag was not set." Global Const WSAENETRESET_S = "The connection must be reset because the Windows Sockets implementation dropped it." Global Const WSAENOTCONN_S = "The socket is not connected." Global Const WSAEOPNOTSUPP_S = "MSG_OOB was specified, but the socket is not of type SOCK_STREAM." Global Const WSAESHUTDOWN_S = "The socket has been shutdown; it is not possible to send() on a socket after shutdown() has been invoked with how set to 1 or 2." Global Const WSAEMSGSIZE_S = "The socket is of type SOCK_DGRAM, and the datagram is larger than the maximum supported by the Windows Sockets implementation." Global Const WSAECONNABORTED_S = "The virtual circuit was aborted due to timeout or other failure." Global Const WSAECONNRESET_S = "The virtual circuit was reset by the remote side." '---------------------------------------------------------------- ' ' Well Known Services ' Global Const WKS_ECHO = 7 Global Const WKS_SYSTAT = 11 Global Const WKS_NETSTAT = 15 Global Const WKS_FTPDATA = 20 Global Const WKS_FTP = 21 Global Const WKS_TELNET = 23 Global Const WKS_SMTP = 25 Global Const WKS_TIME = 37 Global Const WKS_NAME = 42 Global Const WKS_WHOIS = 43 Global Const WKS_DOMAIN = 53 Global Const WKS_HOSTNAME = 101 ' Host Specific Global Const WKS_TFPT = 69 Global Const WKS_RJE = 77 Global Const WKS_FINGER = 79 Global Const WKS_LINK = 87 Global Const WKS_SUPDUP = 95 Global Const WKS_POP_2 = 109 Global Const WKS_UUCP_PATH = 117 Global Const WKS_NNTP = 119 Global Const WKS_NTP = 123 'UNIX Specific Global Const WKS_EXEC = 512 Global Const WKS_LOGIN = 513 Global Const WKS_SHELL = 514 Global Const WKS_BIFF = 512 Global Const WKS_WHO = 513 Global Const WKS_SYSLOG = 514 Global Const WKS_TALK = 517 Global Const WKS_ROUTE = 520